// 导入mongoose模块
let mongoose = require('mongoose')

mongoose.connect('mongodb://localhost/project')
.then(res=>{
    console.log('连接数据库成功');
})
.catch(rej=>{
    console.log('连接数据库失败');
})

// 创建表实例

// 先定义结构    使用schema
let tianmao_Schema = mongoose.Schema({
    imgurl:String,
    title:String,
    price:String,
})
// 创建表
let Tianmao = mongoose.model('tianmao',tianmao_Schema)

// 导出表实例对象
exports.Tianmao = Tianmao